from flask import Blueprint, g, current_app, url_for, redirect, request
from flask_jsontools import jsonapi
from .models import db, User, Task, Cost

bp = Blueprint('task', __name__, url_prefix='/task')

@bp.route('/<int:taskId>/update', methods=('POST', 'GET'))
@jsonapi
def update(taskId):
    if request.method == 'POST':
        task = Task(request.get_json())
    current_app.logger.info(Task.query.filter_by(id=taskId).first_or_404().__json__())
    return Task.query.filter_by(id=taskId).first_or_404()
